home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / AppleScript / Documentation / Apple Event Registry / Word Services Suite 1.0.4 / WSI Library Source / AboutVersion.c next >
Encoding:
C/C++ Source or Header  |  1993-04-12  |  1.2 KB  |  67 lines  |  [TEXT/KAHL]

  1. /* AboutVersion.c
  2.  * Display a version number in an about box
  3.  * Copyright ©1993 Working Software, Inc.  All Rights Reserved.
  4.  * 23 Feb Mike Crawford
  5.  */
  6.  
  7. /* Create an "AboutVersionDef.h" for each project that defines the constant rVersID.
  8.  */
  9.  
  10. #include "AboutVersion.h"
  11. #include "AboutVersionDef.h"
  12.  
  13. void InstallAboutVersionProc( DialogPtr aboutDialog, short versItem )
  14. {
  15.     short        kind;
  16.     Handle        h;
  17.     Rect        r;
  18.  
  19.     GetDItem( aboutDialog, versItem, &kind, &h, &r );
  20.     SetDItem( aboutDialog, versItem, kind, (Handle)AboutVersionProc, &r );
  21.  
  22.     return;
  23. }
  24.  
  25. pascal void AboutVersionProc( DialogPtr dlg, short item )
  26. {
  27.     Handle        h;
  28.     short        kind;
  29.     Rect        r;
  30.     GrafPtr        oldPort;
  31.     VersRecHndl    versH;
  32.     
  33.     /* From Writeswell Jr. -- draw the version number by getting it from the vers
  34.      * resource.  Saves a lot of time when making a new master disk
  35.      */
  36.          
  37.     versH = (VersRecHndl)Get1Resource( 'vers', rVersID );
  38.  
  39.     if ( !versH ){
  40.         return;
  41.     }
  42.     
  43.     GetPort( &oldPort );
  44.     SetPort( dlg );
  45.     
  46.     GetDItem( dlg, item, &kind, &h, &r );
  47.     
  48.     MoveTo( r.left, r.bottom );
  49.     
  50.     HLock( versH );
  51.     
  52.     PenNormal();
  53.     TextFont( applFont );
  54.     TextSize( 12 );
  55.     TextFace( 0 );
  56.  
  57.     DrawString( (*versH)->shortVersion );
  58.     
  59.     HUnlock( versH );
  60.     ReleaseResource( versH );
  61.     
  62.     SetPort( oldPort );
  63.  
  64.     return;
  65. }
  66.  
  67.